package acwing.数学;

import java.util.Scanner;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/21
 */
public class 饮料换购 {

    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int res = n;
        while (n >= 3) {
            res += n / 3;
            n = n / 3 + n % 3;

        }
        System.out.println(res);
    }
}
